package com.sudo.api._admin;

import com.sudo.common.utils.JsonRes;
import com.sudo.common.utils.PagedGridResult;
import com.sudo.dao.admin.entity.SysJobLog;
import com.sudo.dao.admin.model.bo.SysJobLogBO;
import com.sudo.service.admin.service.SysJobLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Slf4j
@Api(value = "定时任务日志接口",tags = {"定时任务日志相关的接口"})
@RestController
@RequestMapping("sysJobLog")
public class SysJobLogController extends AdminBaseController{

    @Resource
    private SysJobLogService sysJobLogService;

    @ApiOperation(value = "分页查询任务日志", notes = "分页查询任务日志", httpMethod = "POST")
    @GetMapping("/getSysJobLogByPage")
    public JsonRes getSysJobLogByPage(SysJobLogBO sysJobLogBO) {
        PagedGridResult pagedGridResult = sysJobLogService.querySysJobLogByPage(sysJobLogBO);
        return JsonRes.ok(pagedGridResult);
    }

    @ApiOperation(value = "查询任务日志", notes = "查询任务日志", httpMethod = "GET")
    @GetMapping("/getSysJobLogById")
    public JsonRes getSysJobLogById(@RequestParam Integer id) {
        SysJobLog sysJobLog = sysJobLogService.getSysJobLog(id);
        return JsonRes.ok(sysJobLog);
    }
}
